import 'package:xinxuan/vo/common_vo/common_blindbox_packages_vo.dart';
import 'package:xinxuan/vo/common_vo/common_costs_vo.dart';
import 'package:xinxuan/vo/seckill_order_detail_vo.dart';

class BlindBoxOrderDetailVo {
  
  BlindBoxOrderDetailData? data;

  BlindBoxOrderDetailVo({this.data});

  BlindBoxOrderDetailVo.fromJson(Map<String, dynamic> json) {
    data = json['data'] != null ? new BlindBoxOrderDetailData.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class BlindBoxOrderDetailData {
  int? id;
  String? orderSn;
  int? payStatus;
  int? teamId;
  int? status;
  String? statusStr;
  int? source;
  String? payableAmount;
  String? paidAmount;
  String? totalAmount;
  String? createdAt;
  String? updatedAt;
  String? companyCode;
  String? companyTitle;
  int? isLottery;
  int? isCheck;
  String? trackingNumber;
  int? remainingTime;
  List<CommonBlindBoxPackagesVo>? packages;
  SeckillOrderAddress? address;
  List<CommonCostsVo>? costs;
  BlindBoxLottery? lottery;

  BlindBoxOrderDetailData(
      {this.id,
      this.orderSn,
      this.payStatus,
      this.teamId,
      this.status,
      this.statusStr,
      this.source,
      this.payableAmount,
      this.paidAmount,
      this.totalAmount,
      this.createdAt,
      this.updatedAt,
      this.companyCode,
      this.companyTitle,
      this.isLottery,
      this.isCheck,
      this.trackingNumber,
      this.remainingTime,
      this.packages,
      this.address,
      this.costs,
      this.lottery});

  BlindBoxOrderDetailData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    orderSn = json['order_sn'];
    payStatus = json['pay_status'];
    teamId = json['team_id'];
    status = json['status'];
    statusStr = json['status_str'];
    source = json['source'];
    payableAmount = json['payable_amount'];
    paidAmount = json['paid_amount'];
    totalAmount = json['total_amount'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    companyCode = json['company_code'];
    companyTitle = json['company_title'];
    isLottery = json['is_lottery'];
    isCheck = json['is_check'];
    trackingNumber = json['tracking_number'];
    remainingTime = json['remaining_time'];
    if (json['packages'] != null) {
      packages = <CommonBlindBoxPackagesVo>[];
      json['packages'].forEach((v) {
        packages!.add(new CommonBlindBoxPackagesVo.fromJson(v));
      });
    }
    address =
        json['address'] != null ? new SeckillOrderAddress.fromJson(json['address']) : null;
    if (json['costs'] != null) {
      costs = <CommonCostsVo>[];
      json['costs'].forEach((v) {
        costs!.add(new CommonCostsVo.fromJson(v));
      });
    }
    if (json['is_lottery'] == 1) {
      lottery = json['lottery'] != null ? new BlindBoxLottery.fromJson(json['lottery']) : null;
    } else {
      lottery = null;
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['order_sn'] = this.orderSn;
    data['pay_status'] = this.payStatus;
    data['team_id'] = this.teamId;
    data['status'] = this.status;
    data['status_str'] = this.statusStr;
    data['source'] = this.source;
    data['payable_amount'] = this.payableAmount;
    data['paid_amount'] = this.paidAmount;
    data['total_amount'] = this.totalAmount;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    data['company_code'] = this.companyCode;
    data['company_title'] = this.companyTitle;
    data['is_lottery'] = this.isLottery;
    data['is_check'] = this.isCheck;
    data['tracking_number'] = this.trackingNumber;
    data['remaining_time'] = this.remainingTime;
    if (this.packages != null) {
      data['packages'] = this.packages!.map((v) => v.toJson()).toList();
    }
    if (this.address != null) {
      data['address'] = this.address!.toJson();
    }
    if (this.costs != null) {
      data['costs'] = this.costs!.map((v) => v.toJson()).toList();
    }
    if (this.lottery != null) {
      data['lottery'] = this.lottery!.toJson();
    }
    return data;
  }
}

class BlindBoxLottery {
  int? packageId;
  int? productId;
  int? status;
  BlindBoxProduct? product;

  BlindBoxLottery({this.packageId, this.productId, this.status, this.product});

  BlindBoxLottery.fromJson(Map<String, dynamic> json) {
    packageId = json['package_id'];
    productId = json['product_id'];
    status = json['status'];
    product =
        json['product'] != null ? new BlindBoxProduct.fromJson(json['product']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['package_id'] = this.packageId;
    data['product_id'] = this.productId;
    data['status'] = this.status;
    if (this.product != null) {
      data['product'] = this.product!.toJson();
    }
    return data;
  }
}

class BlindBoxProduct {
  String? title;

  BlindBoxProduct({this.title});

  BlindBoxProduct.fromJson(Map<String, dynamic> json) {
    title = json['title'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['title'] = this.title;
    return data;
  }
}